package com.winz.cultureapp.activity;

import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.winz.cultureapp.R;
import com.winz.cultureapp.base.BaseAppCompatActivity;
import com.winz.cultureapp.entity.AppUpdateBean;
import com.winz.cultureapp.entity.CodeBean;
import com.winz.cultureapp.http.OnResponeListener;
import com.winz.cultureapp.http.request.RequestFactory;
import com.winz.cultureapp.http.util.HttpUitls;
import com.winz.cultureapp.utils.JsonUtil;
import com.winz.cultureapp.utils.Logger;
import com.winz.cultureapp.utils.VserionNameUtil;

import butterknife.BindView;
import butterknife.OnClick;

public class CodeActivity extends BaseAppCompatActivity {
    @BindView(R.id.tv_top_title)
    TextView mTv_title;
    @BindView(R.id.iv_code)
    ImageView ivCode;

    @Override
    protected int contentView() {
        return R.layout.activity_code;
    }

    @Override
    protected void initViews() {
        mTv_title.setText("扫码下载");
        HttpUitls.onGet("app_upate_new",new OnResponeListener<CodeBean>() {
            @Override
            public void onSuccess(CodeBean appUpdateBean) {
                Logger.d("app_upate_new==>>", JsonUtil.getJsonFromObj(appUpdateBean));
                if (appUpdateBean.code == 0) {
                    Glide.with(context)
                            .load(appUpdateBean.data)
                            .error(R.drawable.code_app)
                            .into(ivCode);
                }
            }

            @Override
            public void onFailed(String error) {

            }
        });

    }

    @OnClick(R.id.fl_back)
    public void onClick() {
        finish();
    }

}
